<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    //设置请求头,告诉服务器内容类型(JSON字符串)
    xhr.open('POST')
    xhr.setRequestHeader('Content-Type','appplication/json')
    const userObj={
        username:'itheima007',
        password:'9193948'
    }
    //转换为JSON字符串
    const useStr=JSON.stringify(userObj)
    //设置请求体 发送请求
    xhr.send(userStr)

</body>
</html>